package ru.vboxdc.actions;

import com.opensymphony.xwork2.ActionSupport;
import ru.vboxdc.ObjectPool;

/**
 * User: lelon
 * Date: 01.02.2009
 * Time: 18:08:53
 */
public class VirtualMachineStop extends ActionSupport {
    private int id;
    private ObjectPool objectPool = ObjectPool.get();


    public String execute() {
        try {
            objectPool.getVirtualMachine(id).getManager().stopVM();
            addActionMessage("Machine " + objectPool.getVirtualMachine(id) + " stopped");
        } catch (Exception e) {
            addActionError(e.getMessage());
            addActionError(e.getClass().toString());
        }
        return SUCCESS;
    }


    public void setId(int id) {
        this.id = id;
    }

}